﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using JOIN.Rights.BLL;
using System.Web.Script.Serialization;
using Kevin.Framework.Data.OrmMapping;
using JOIN.Rights.Model;
using Kevin.Framework.Validation;
using Kevin.Framework.Data;
using System.Threading;

namespace JOIN.Rights.Web.Services
{
    /// <summary>
    /// Summary description for BLLService1
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class BLLService1 : System.Web.Services.WebService
    {

        #region   Action Service

        [WebMethod]
        public ServiceResult<ActionInfo> ActionService(string operationMode, string jsonEntity)
        {
            IBLL<ActionInfo> bll = new ActionBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<ActionInfo> GetActionInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<ActionInfo> bll = new ActionBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   Area Service

        [WebMethod]
        public ServiceResult<AreaInfo> AreaService(string operationMode, string jsonEntity)
        {
            IBLL<AreaInfo> bll = new AreaBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<AreaInfo> GetAreaInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<AreaInfo> bll = new AreaBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region Company Service

        [WebMethod]
        public ServiceResult<CompanyInfo> CompanyService(string operationMode, string jsonEntity)
        {
            IBLL<CompanyInfo> bll = new CompanyBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<CompanyInfo> GetCompanyInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<CompanyInfo> bll = new CompanyBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   Function Service

        [WebMethod]
        public ServiceResult<FunctionInfo> FunctionService(string operationMode, string jsonEntity)
        {
            IBLL<FunctionInfo> bll = new FunctionBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<FunctionInfo> GetFunctionInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<FunctionInfo> bll = new FunctionBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }
        [WebMethod]
        public ServiceResult<FunctionInfo> GetFunctionInfoListByRoleID(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<FunctionInfo> bll = new FunctionBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   Menus Service

        [WebMethod]
        public ServiceResult<MenusInfo> MenusService(string operationMode, string jsonEntity)
        {
            IBLL<MenusInfo> bll = new MenusBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<MenusInfo> GetMenusInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<MenusInfo> bll = new MenusBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   OnlineUser Service

        [WebMethod]
        public ServiceResult<OnlineUserInfo> OnlineUserService(string operationMode, string jsonEntity)
        {
            IBLL<OnlineUserInfo> bll = new OnlineUserBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<OnlineUserInfo> GetOnlineUserInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<OnlineUserInfo> bll = new OnlineUserBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   Org Service

        [WebMethod]
        public ServiceResult<OrgInfo> OrgService(string operationMode, string jsonEntity)
        {
            IBLL<OrgInfo> bll = new OrgBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<OrgInfo> GetOrgInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<OrgInfo> bll = new OrgBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   OrgArea Service

        [WebMethod]
        public ServiceResult<OrgAreaInfo> OrgAreaService(string operationMode, string jsonEntity)
        {
            IBLL<OrgAreaInfo> bll = new OrgAreaBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<OrgAreaInfo> GetOrgAreaInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<OrgAreaInfo> bll = new OrgAreaBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   Project Service

        [WebMethod]
        public ServiceResult<ProjectInfo> ProjectService(string operationMode, string jsonEntity)
        {
            IBLL<ProjectInfo> bll = new ProjectBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<ProjectInfo> GetProjectInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<ProjectInfo> bll = new ProjectBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   Resource Service

        [WebMethod]
        public ServiceResult<ResourceInfo> ResourceService(string operationMode, string jsonEntity)
        {
            IBLL<ResourceInfo> bll = new ResourceBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<ResourceInfo> GetResourceInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<ResourceInfo> bll = new ResourceBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   Role Service

        [WebMethod]
        public ServiceResult<RoleInfo> RoleService(string operationMode, string jsonEntity)
        {
            IBLL<RoleInfo> bll = new RoleBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<RoleInfo> GetRoleInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<RoleInfo> bll = new RoleBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   RoleAction Service

        [WebMethod]
        public ServiceResult<RoleActionInfo> RoleActionService(string operationMode, string jsonEntity)
        {
            IBLL<RoleActionInfo> bll = new RoleActionBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<RoleActionInfo> GetRoleActionInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<RoleActionInfo> bll = new RoleActionBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   RoleFunction Service

        [WebMethod]
        public ServiceResult<RoleFunctionInfo> RoleFunctionService(string operationMode, string jsonEntity)
        {
            IBLL<RoleFunctionInfo> bll = new RoleFunctionBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<RoleFunctionInfo> GetRoleFunctionInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<RoleFunctionInfo> bll = new RoleFunctionBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   User Service

        [WebMethod]//operationMode
        public ServiceResult<UserInfo> UserService(string operationMode, string jsonEntity)
        {
            //Thread.Sleep(5000);
            IBLL<UserInfo> bll = new UserBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<UserInfo> GetUserInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<UserInfo> bll = new UserBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        [WebMethod]
        public ServiceResult<UserInfo> GetUserInfoListByRoleID(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<UserInfo> bll = new UserBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }
        #endregion

        #region   UserArea Service

        [WebMethod]
        public ServiceResult<UserAreaInfo> UserAreaService(string operationMode, string jsonEntity)
        {
            IBLL<UserAreaInfo> bll = new UserAreaBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<UserAreaInfo> GetUserAreaInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<UserAreaInfo> bll = new UserAreaBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   UserOrg Service

        [WebMethod]
        public ServiceResult<UserOrgInfo> UserOrgService(string operationMode, string jsonEntity)
        {
            IBLL<UserOrgInfo> bll = new UserOrgBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<UserOrgInfo> GetUserOrgInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<UserOrgInfo> bll = new UserOrgBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

        #region   UserRole Service

        [WebMethod]
        public ServiceResult<UserRoleInfo> UserRoleService(string operationMode, string jsonEntity)
        {
            IBLL<UserRoleInfo> bll = new UserRoleBLL(operationMode, jsonEntity);
            return bll.Excute();
        }
        [WebMethod]
        public ServiceResult<UserRoleInfo> GetUserRoleInfoList(int pageSize, int pageIndex, string jsonCondition)
        {
            ISelect<UserRoleInfo> bll = new UserRoleBLL("Query", jsonCondition);
            return bll.SelectByProperties(pageSize, pageIndex);
        }

        #endregion

    }

   
}
